package com.Jeu;
import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;

public class Score implements Serializable, Comparable<Score>{
	private String name;
	private long score;
	
	public Score(long score, String name)
	{
		this.score = score;
		this.name = name;
	}
	
	public void updateName(String name)
	{
		this.name =  name;
	}
	public void updateScore(long score)
	{
		this.score = score;
	}
	
	public String getName()
	{
		return this.name;
	}
	
	public long getScore()
	{
		return this.score;
	}
	
	//***************************************************************//
    //******************** OVERRIDE DES OPERATEURS ******************//
    //***************************************************************//    
  	@Override
	public int compareTo(Score arg0) {
		// TODO Auto-generated method stub		
		if(this.score > arg0.score)
			return 1;
		else if(this.score == arg0.score)
			return 0;
		
		return -1;
	}           
  	@Override
  	 public boolean equals(Object obj)
  	{
  		 if (!(obj instanceof Score)) 
         {
             return false;
         }
         
  		Score other = (Score) obj;
         
         if (other.getScore() == this.getScore()) 
         {
             return true;
         }
         return false;
  	}
	

}
